<%@page import="br.com.conexao.fateca.Conexao"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%
    String usuario = request.getParameter("login");
    String senha = request.getParameter("senha");

    Connection con = null;
    Statement stat = null;
    ResultSet rs = null;
    con = Conexao.getConnection();
    stat = con.createStatement();
    rs = stat.executeQuery("SELECT * FROM usuario WHERE nm_usuario = '" + usuario + "' AND cd_senha = '" + senha + "'");
    
    if(rs.next()){
        
     session.setAttribute("usuario", rs.getString("cd_usuario"));
     response.sendRedirect("lstemprestimo.jsp");
    }

%>
<br>
<div class="container">
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <img src="imagens/fatecalogo.jpg" style="width:100%" />
                </div>
                <div class="panel-body">
                    <form accept-charset="UTF-8" method="post" action="index.jsp" role="form">
                        <fieldset>
                            <div class="form-group">
                                <input class="form-control" placeholder="Login" name="login" type="text">
                            </div>
                            <div class="form-group">
                                <input class="form-control" placeholder="Senha" name="senha" type="password" value="">
                            </div>

                            <input class="btn btn-lg btn-success btn-block" type="submit" value="Login">
                        </fieldset>
                    </form>
                    <link href="css/bootstrap.min.css" rel="stylesheet">

                </div>
            </div>
        </div>
    </div>
</div>